pull: Ignore the cancellable when aborting a transaction
authorJoaquim Rocha <jrocha@endlessm.com>
Mon, 12 Mar 2018 12:24:22 +0000 (13:24 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 12 Mar 2018 19:18:57 +0000 (19:18 +0000)
In ostree_repo_abort_transaction, if we pass a cancellable and it gets
canceled, then the function may fail to fully clean up the transaction
state. This was happening e.g. when the ostree_repo_pull_with_options
call got cancelled.

To fix this, as suggested by Colin Walters, we set the passed
cancellable as NULL, in order for it to be ignored.

https://github.com/ostreedev/ostree/issues/1491

Closes: #1492
Approved by: jlebon

src/libostree/ostree-repo-commit.c

index 875743b4d39da031a3a5ff5adbe9272536539e69..16081a95c84eabfb2ac0ff20c1dfa6d3a106c4c1 100644 (file)
@@ -2153,6 +2153,12 @@ ostree_repo_abort_transaction (OstreeRepo     *self,
                                GCancellable   *cancellable,
                                GError        **error)
 {
+  /* Always ignore the cancellable to avoid the chance that, if it gets
+   * canceled, the transaction may not be fully cleaned up.
+   * See https://github.com/ostreedev/ostree/issues/1491 .
+   */
+  cancellable = NULL;
+
   /* Note early return */
   if (!self->in_transaction)
     return TRUE;